//
//  UsefulUtil.h
//  NiuBanJinGold
//
//  Created by Billy on 15/9/24.
//  Copyright (c) 2015年 zzjr. All rights reserved.
//

/**
        功能:   用于放置除网络访问以外的所有的公共方法
 
 */

#import <Foundation/Foundation.h>

@interface UsefulUtil : NSObject

// 转换16进制颜色成UIColor
+ (UIColor *) colorWithHexString: (NSString *) hexStringToConvert ;

// 判定电话号码正确性
+ (BOOL)isMobileNumber:(NSString *)mobileNumber;

//验证身份证
+(BOOL)isIDNumber:(NSString *)IDNumber;

//获取UUID

+(NSString *)getUDIDOfCurrentDevice;

//判定用户输入是否是中文

+ (BOOL)isChinese:(NSString *)msg;

// 获得用户真实利率

+ (NSString *) userRealRate;

//倒计时方法
+ (void) countDownMethodForButton:(UIButton *) button timeOutValue:(NSInteger ) value ;

//弹出提示对话框
+ (void) showAlertView:(NSString *) message ;

// 查找系统字体
+(NSArray *) searchFontByFontName:(NSString *) fontName ;
+ (NSArray *) allSupportedFonts ;

//创建 label
+ (UILabel *) labelCreationWithFrame:(CGRect ) frame textColor:(UIColor *) color fontName:(UIFont *) font text:(NSString *) text ;

//创建 button
+ (UIButton *) buttonCreationWithFrame:(CGRect ) frame textColor:(UIColor *) color fontName:(UIFont *) font text:(NSString *) text;
+ (UIButton *) buttonCreationWithFrame:(CGRect ) frame textColor:(UIColor *) color fontName:(UIFont *) font text:(NSString *) text frontImageName: (NSString *) name ;

// 创建 layer
+ (CALayer *) layerCreationWithFrame:(CGRect ) frame andContents:(id) content ;

+ (CATextLayer *) textLayerCreationWithFrame: (CGRect ) frame  content:(NSString *) text fontSize:(CGFloat) size ;

// 创建 view
+ (UIView *) viewCreationWithFrame:(CGRect ) frame backgroundColor:(UIColor *) color backGroundImage:(UIImage *) image ;

// 创建 imageView
+ (UIImageView *) imageViewCreationWithFrame:(CGRect ) frame image:(UIImage *) image ;

// 存自定义object

+ (void) saveCustomObject:(NSObject *) obj intoUserDefaultByKey:(NSString *) key;

// 取自定义object

+ (NSObject *) getCustomObjectByKey:(NSString *)key;

// 删除自定义object

+ (void) clearAddressInfoFromUserDefault ;

// 动态计算文字所占用的size

+ (CGSize)labelAutoCalculateRectWith:(NSString*)text FontSize:(CGFloat)fontSize MaxSize:(CGSize)maxSize;




@end
